'; window.popUpWin.document.write(zhtm); window.popUpWin.document.close(); // Johnny Jackson 4/28/98 } //--> Inside AutoCAD 14 -- Ch 8 -- Creating Polylines and Splines


Inside AutoCAD 14

Previous chapterNext chapterContents


- 8 -

Creating Polylines and Splines


by David M. Pitzer

In the previous chapter, you learned about lines and arcs and how to use them to draw straight line segments and circular arcs. Lines and arcs are separate entities, even if they are connected end-to-end. A box drawn with the LINE command, for example, is really four separate line segments whose endpoints share an endpoint with another line segment. Polylines, however, are multi-segmented objects; they can be composed of multiple straight or curved segments. A polyline, no matter how many segments it is composed of, acts as a single, multi- segmented line.

In most AutoCAD drawings, you use traditional elements, such as lines, arcs, polylines, and circles. Sometimes, however, you may want to draw smooth, irregular curves. AutoCAD provides the spline object for drawing free-form irregular curves. Splines are useful when you need to draw map contours, roads, walkways, or other smooth, flowing objects.

This chapter covers the following topics on polylines and splines:

Polylines versus Lines

Polylines are different from the line segments created by AutoCAD's LINE command. Polylines are treated as single objects and can include both line and arc segments connected at their vertices. AutoCAD stores information about the vertices and you can access this information and edit the appearance of the polyline.

Polylines offer two advantages over lines. First, polylines are versatile; they can be straight or curved, thin or wide, and even tapered. Figure 8.1 shows some of the various forms a polyline can take.

Figure 8.1 Polylines can assume various forms.

Second, editing polylines is easier; you can select any segment of a polyline because all segments are connected. This makes editing operations, such as moving or copying, faster and more accurate. Objects drawn with lines and arcs may appear to be connected but, depending on how they were drawn, may actually have gaps or discontinuities that make using them as boundaries for cross hatching difficult.

Creating Polylines

Polylines are created using the PLINE command. The PLINE command enables you to draw two basic kinds of polyline segments, straight lines and arcs, so some PLINE prompts are the same as those you find in the LINE and ARC command prompts. If, for example, you draw straight polyline segments, you will find options such as Endpoint, Close, and Undo. You see these options in the standard polyline prompt for line segments:

 Arc/Close/Halfwidth/Length/Undo/Width/<Endpoint of line>:

In addition, certain prompts are specific to polylines:

If, at the prompt for a new straight line segment, you select the Arc option, the Arc mode options prompt appears:

Angle/CEnter/CLose/Direction/Halfwidth/Line/Radius/Second pt/Undo/Width/<Endpoint of arc>:

This prompt contains some of the same options as the ARC command. The options include the following:


TIP: You can close a polyline of two or more segments after the fact; use the PEDIT command's Close option. Using the PEDIT Close option draws a line between the last point of the polyline and the first. The PEDIT command is covered later in this chapter.

Although using the PLINE command to draw lines and arcs is similar to using the LINE and ARC commands to draw similar objects, there are several important differences.

In the following exercise, you practice drawing a single polyline using many of the options for both the Line and Arc mode options of the POLYLINE command.

PRACTICING WITH THE POLYLINE COMMAND OPTIONS

1. Begin a new drawing named chap08.dwg using this chapter's IAC801.DWG on the accompanying CD as a template (see fig. 8.2).

2. Start the POLYLINE command by typing PL and pressing Enter. The initial polyline prompt From point: appears. Respond by entering the point 2.5,1.0 and pressing Enter. The line mode options prompt appears.

Figure 8.2 Drawing a multi-segment polyline.

3. Use the default endpoint option by entering the relative polar coordinate @5<90 and pressing Enter. AutoCAD draws the first segment of the polyline from 1 to 2. The Line options prompt re-appears.

4. Switch to the Polyarc mode by typing A and pressing Enter. The Arc mode options prompt appears.

5. Use the default Endpoint of arc: option by typing @.25<45 and pressing Enter. AutoCAD draws the polyarc to 3. The Arc mode options prompt re-appears, as in step 4.

6. Switch back to the Line mode by typing L and pressing Enter. The Line mode options appear. Choose the Length option by entering L and pressing Enter. Then at the Length of line: prompt, type 3 and press Enter for the length. AutoCAD draws the next segment 3 units long, to 4. Now switch back to the Arc mode.

7. Choose the angle option by typing A and pressing Enter. Type -90 and press Enter at the Included angle: prompt. This specifies a 90 degree clockwise angle at 5. The Center/Radius/<Endpoint>: prompt appears.

8. Choose the Radius option by typing R and pressing Enter. Then enter the value .125 and press Enter. Respond to the Direction of chord <0>: prompt by typing 315 and pressing Enter.

9. Switch to the line mode again and choose the Width option by entering W and pressing Enter at the Line mode prompt.

10. Respond to the Starting width <0.0>: prompt by typing 0.1 and pressing Enter. Accept the Ending width <0.1>: prompt by pressing Enter. Respond to the Line mode prompt by entering @1<-90 and pressing Enter.

11. AutoCAD draws the next segment with a uniform width of 0.1 units 6. At the Endpoint of line: prompt, enter the relative coordinate @2,0 and press Enter. AutoCAD draws the next segment at the current width of 0.1 units.

12. Switch to the Arc mode by typing A and pressing Enter at the Line mode prompt. Respond to the Arc mode prompt by typing CE and pressing Enter. Then type @.25, -.25 and press Enter to specify the center of the next arc section.

13. Respond to the next two prompts as follows:

Angle/Length/<End point>: A¯ Included angle: -90¯ (see 7)

14. Switch to the line mode (type L and press Enter) and enter the relative polar coordinate; type @2<270 and press Enter in response to the endpoint: prompt.

15. AutoCAD draws the next line segment at the current 0.1 width 8. Now change the width for the next segment by typing W and pressing Enter. Respond to the width prompts as follows:

Starting width <0.1>: 0 ¯ Ending Width <0.0>: ¯

16. Now respond to the Line mode prompt by typing L and pressing Enter to select the Length option. Respond to the Length of line: prompt by typing 2.05 and pressing Enter. AutoCAD draws the next segment at 0 width to 9.

17. At the next Line mode prompt, choose the Close option by typing C and pressing Enter. AutoCAD closes the polyline by drawing the next segment to 1 and exits the POLYLINE command.

18. Your drawing should now resemble figure 8.2. You continue using this drawing in the next exercise. For now, press Ctrl+S to save the drawing.


NOTE: Polylines can consist of a number of segments, with the possibility of significant changes in the polyline's characteristics taking place from segment to segment. The endpoint of one segment is the start point of the next. Later, when we discuss editing polylines, we refer to these points collectively as vertices or singly as a vertex.

As you saw in the preceding exercise, you can easily switch back and forth between the Line mode and the Arc mode in the POLYLINE command. Each mode has its own set of prompts that repeat after you draw each segment. You also noticed that both line and arc segments can have widths other than zero, and that when you specify a new width, it becomes the default width for the next segment. In other words, both the mode (Line versus Arc) and the width remain in effect unless and until you explicitly change them.

In the following exercise, you construct an arc leader using both the Line and Arc modes as well as the capability to vary the width of a single polyline segment.

DRAWING AN ARC LEADER WITH A POLYLINE

1. Continue in the drawing from the preceding exercise. Refer to figure 8.3 for this exercise.

Figure 8.3 Picking the point for an arc-leader.

2. Begin the POLYLINE command by choosing the Polyline tool from the Draw menu. The From point: prompt appears.

3. Pick a point near 1 in figure 8.3, and then choose the Width option by typing W and pressing Enter.

4. Respond to the two width prompts as follows:

Starting width <0.0>: ¯ Ending width <0.0>: .1¯

5. The Line mode prompts appear. Respond to the default Endpoint of line: prompt by typing @.2<115 and pressing Enter.

6. AutoCAD draws the first segment with a tapered width and the prompt returns. Type W and press Enter.

7. Respond to the width prompts as follows:

Starting width <0.1>: 0¯ Ending width <0.0>: ¯

8. Now respond to the Line mode prompt by choosing the Arc option by typing A and pressing Enter.

9. The Arc mode prompts appear. Respond to the default <Endpoint of arc>: prompt by moving your cursor to a point near 2 and picking. AutoCAD draws the arc and exits the POLYLINE command.

Your drawing should now resemble figure 8.4.

10. Save this drawing.

Figure 8.4 Constructing an arc-leader with a polyline.

The preceding exercise emphasizes the versatility of polylines. Not only can polylines have varying width, but each segment can have different starting and ending widths. The current polyline width is stored in the system variable PLINEWID.

Controlling Polyline Appearance with FILL

A drawing that consists of a large number of polylines with widths other than zero can severely increase the time AutoCAD takes to redraw the screen or to plot the drawing. AutoCAD provides the FILL command to enable you to control the visibility of the filled portion of wide polylines. When you turn FILL off, AutoCAD displays or plots only the outline of filled polylines. You must regenerate the drawing before you can see the effect of the FILL command. Figure 8.5 shows the effect of having FILL on and off.

Figure 8.5 Fill can be turned on or off.


NOTE: The FILL command actually controls the setting of the system variable FILLMODE. A setting of 1 is the same as having FILL on; a setting of 0 is the same as having FILL off.

In addition to polylines, the FILL command controls the appearance of solid fill hatches and of objects created using the SOLID, TRACE, and MLINE commands.

Lightweight Polylines

In AutoCAD Release 14, there is a new polyline object, called a lightweight polyline, that serves as a replacement for the 2D polyline found in earlier releases. Lightweight polylines provide most of the functionality of the older 2D polyline, but also offer substantially improved performance and reduced storage requirements in the AutoCAD database. Briefly, lightweight polylines do not store their vertex data as separate entities like 2D polylines do. Instead, they store this data as an array along with the lightweight polyline object data. The "behind-the-scenes" result is a "lighter," more efficient polyline object.

All polylines created using the POLYLINE command are, by default, lightweight polylines, although you can override that rule by using the system variable PLINETYPE, described in the next section, "PLINETYPE System Variable."

A lightweight polyline can have the following characteristics:

Some of the functionality and control available in the older 2D polyline objects are not available in lightweight polylines, including arc fit curve data, spline fit data, and curve fit tangent direction data.

PLINETYPE System Variable

To provide compatibility with the older 2D polyline object of previous AutoCAD releases (Release 13 and before), the system variable PLINETYPE is provided in AutoCAD Release 14. PLINETYPE specifies whether AutoCAD uses optimized, lightweight polylines. It controls both the creation of new polylines with the PLINE command and the conversion of existing polylines in drawings from previous releases. PLINETYPE can have one of three settings, with the following meanings:

0 Polylines in older drawings are not converted on open; PLINE creates old-format (2D) polylines.

1 Polylines in older drawings are not converted on open; PLINE creates lightweight (optimized) polylines.

2 Polylines in older drawings are converted on open; PLINE creates lightweight (optimized) polylines.


NOTE: PLINETYPE also controls the polyline type created by using the following commands: BOUNDARY (when object type is set to Polyline); DONUT; ELLIPSE (when PELLIPSE is set to 1); PEDIT (when selecting a line or arc); POLYGON; and SKETCH (when SKPOLY is set to 1).

You also can manually convert the older 2D polylines by using the new Release 14 CONVERT command, which is described next.

CONVERT Command

Because old-style polylines are not necessarily automatically converted to the newer optimized polylines in Release 14, and because old-style polylines may be created in Release 14 drawings either by the user (by inserting an exploding block containing old-style polylines) or by third-party applications (depending on how the system variable PLINETYPE is set), AutoCAD Release 14 provides the CONVERT command, which enables you to explicitly convert 2D polylines (or associative hatch objects, covered in Chapter 17, "Drawing Hatch Patterns") to the optimized, lightweight polyline format. The prompts for the CONVERT command are as follows:

 Hatch/Polyline/<All>: 

You may enter H for hatches, P for polylines, or A for both. The next prompt appears:

Select/<All>:

Enter S to select objects or A to convert all candidate objects in the drawing. Depending on your response to these two prompts, AutoCAD displays one or both of the following messages:

number hatch objects converted.
number 2d polyline objects converted.
Where number is the number of polylines actually converted.


NOTE: Polylines that contain curve fit or splined segments always retain the old-style format, as do polylines that contain extended entity data.

The new lightweight polyline object offers increased efficiency because it requires less memory to store its data and because it decreases the drawing file storage space requirements. Except for lightweight polylines' inability to handle curve fit and spline fit data, optimized, they behave exactly like the old-style 2D polylines.

The 3DPLOY Command

The 3DPOLY command produces three-dimensional polylines. 3D polylines in some respects are not as versatile as either lightweight polylines or 2D polylines because they can only contain straight line segments with no width information. They are more versatile than lightweight or 2D polylines, however, because you can draw them with a 3D, Z coordinate, in addition to the required X and Y coordinates.

Editing Polylines

As you have seen so far in this chapter, polylines are complex objects, capable of consisting of a collection of arc and line segments, each possessing the additional capability of containing width information. AutoCAD, therefore, provides the PEDIT command, a command devoted to editing these complex entities. As with 2D polylines, 3D polylines, meshes, and pface meshes, lightweight polylines are edited with the PEDIT command. PEDIT does not differentiate between the new lightweight and the old-style polylines.

Editing Entire Polylines with PEDIT

PEDIT contains a large number of subcommands or options for the various polyline properties. To manage this large number of options, AutoCAD divides them into two groups of editing functions. The primary group operates on the polyline as a whole, while a secondary group is devoted to the vertices that mark the beginnings and ends of polyline segments. The primary group of PEDIT options are as follows:

Figure 8.6 The effect of turning Ltype Gen on and off.

When PEDIT prompts Select polyline:, you can pick a polyline line, arc, or other polyline object. The PEDIT command operates on only one object at a time. PEDIT does not support noun/verb selection. Before you select a wide polyline, you must select either an edge or at a vertex. You can use a Window or Crossing selection, but you must first enter W or C because PEDIT does not support the implied windowing selection feature. For convenience, you also can use the Last, Box, Fence, All, Wpolygon, and Cpolygon (but not Previous) selection methods. Selection ends as soon as PEDIT finds a line, arc, or polyline. If your selection method includes more than one, PEDIT selects only one, usually the youngest, or most recently created, one. If the first object you select is not a polyline, AutoCAD asks if you want to turn it into one.

In the following exercise, you practice using some of the options of the primary PEDIT command options.

USING THE PRIMARY OPTIONS OF THE PEDIT COMMAND

1. Start a new drawing called Parking.dwg, using the CH08b.DWG on the accompanying CD as a template (see fig. 8.7).

2. Start the PEDIT command by typing PE and pressing Enter. You will first join two separate polylines. At the Select polyline: prompt, pick the line at 1. The primary PEDIT prompt appears.

Figure 8.7 Editing entire polylines.

3. Choose the Join option by entering J and pressing Enter. Then at the Select objects: prompt, pick the polyline at 2 and close the selection process by pressing Enter. AutoCAD joins the two lines into a single polyline and the primary prompt returns.

4. Next, use the Width option to change the width of the new polyline. Choose the Width option by typing W and pressing Enter. Answer the Enter new width for all segments: prompt by typing 9 and pressing Enter.

5. Note that the polyline changes to a new width of 9 inches and the prompt returns. The line is too wide. Type U and press Enter to undo the previous edit. The prompt returns. Type W and press Enter again. At the Enter new width for all segments: prompt, enter 3 and press Enter. The line changes width, and then the prompt returns. Note that the default option is eXit <X>. Accept this option by pressing Enter. The PEDIT command ends.

6. Next, you convert an arc object into a polyarc and join it to two polylines. Press Enter or the spacebar to restart the PEDIT command. At the Select polyline: prompt, pick the arc object at 3. The following prompts appear:

Object selected is not a polyline Do you want to turn it into one? <Y>

7. Accept the default, <Y>, yes option by pressing Enter. The primary PEDIT prompt appears. Choose the Join option by typing J and pressing Enter. At the Select objects: prompt, pick the two polylines at 4. AutoCAD joins the three polylines. Press Enter to end the PEDIT command.

8. Next, you will explode a polyline, using AutoCAD's EXPLODE command. To start the EXPLODE command, type EXPLODE and press Enter at the Command: prompt. The Select objects: prompt appears.

9. Pick the arrow at 5 and press Enter. Note that the width information for this polyline disappears. Actually, AutoCAD destroys the polyline, demoting it to a Line object.

10. Restore the polyline arrow with the U command by entering U and pressing Enter. AutoCAD restores the polyline object.

11. You will use this drawing in the next exercise. For now, press Ctrl+S to save it.

In the preceding exercise, you saw that you can work with one polyline at a time. The primary PEDIT prompt with its several options returns after each edit operation, on the assumption that you may want to edit another polyline parameter. You must specifically dismiss the prompt by either accepting the default eXit option or pressing Esc to cancel the command. Also note that several of the options in the primary prompt undo other options. For example, after performing a Fit (curve) edit, you can undo the operation with the Decurve option. The Undo option undoes the last edit operation and returns the primary prompt. The EXPLODE command destroys a polyline and reduces it to a lower order object, either a line or arc.


TIP: You can produce a wide polyline with an apparent mitered end by using a trick. After specifying the last vertex, set the width to taper from the current full width to zero, and then draw another very short segment using a typed relative polar coordinate. The "miter" will appear perpendicular to the angle you type.

For example, enter @0.00001<45 to miter the top of a vertical wide polyline to an angle of 135 degrees (45 + 90). The end of the last segment is actually pointed, but the extremely short length has the effect of ending the previous segment with a miter.


Using the PEDIT Fit and Spline Options

PEDIT provides two options for making a polyline that passes through or is influenced by control points (see fig. 8.8). A fit curve actually passes through vertex points and consists of two arc segments between each pair of vertices. A spline-fit curve interpolates between control points, but the curve doesn't necessarily pass through the points.

Figure 8.8 Creating curves from polylines.

To help you visualize a spline-fit curve, AutoCAD provides the system variable SPLFRAME. If you set SPLFRAME to a value of 1, the reference frame with control points appears. Figure 8.8 shows only the control points. In the case of the original polyline, the control points are coincident with the polyline's vertices. In the instance of the fit curve example, the straight line segments between control points (vertices) have been replaced with arc segments, but still pass through the control points. The spline-fit curve uses the control points as guides to influence the shape of curve.

AutoCAD can generate two types of spline-fit polylines: a quadric b-spline and a cubic b-spline. The system variable SPLINETYPE controls the type of curve generated. A SPLINETYPE value of 5 approximates a true quadric b-spline; a value of 6 approximates a true cubic b-spline. In addition, the system variable SPLINESEGS controls the fineness of the b-spline. The numeric value of SLINESEGS sets the number of line segments in the control frame.

In the following exercise, you use both the Fit and Spline options of PEDIT to generate curves from polylines.

GENERATING CURVES WITH PEDIT

1. Continue in the drawing from the previous exercise (see fig. 8.9).

2. First, zoom in to the contour lines area of the parking lot. Start the ZOOM command by typing Z and pressing Enter. The Zoom prompt appears.

3. Choose the Center option from the Zoom prompt by typing C and pressing Enter.

4. Respond to the Center point: prompt by typing 70',68' and pressing Enter. At the Magnification or height <0'-0">: prompt, type 1.5x and press Enter. Your drawing should resemble figure 8.9.

Figure 8.9 Creating smooth curves with PEDIT.

5. You will smooth the contour line at 1 first. Start the PEDIT command by typing PE and pressing Enter. Pick the polyline at 1 at the Select polyline: prompt. The primary PEDIT options appear. Type F (for Fit) and press Enter.

6. AutoCAD performs a fit curve smoothing on the polyline and the prompt returns. This does not smooth the curve as you want, so select the Undo option by typing U and pressing Enter. AutoCAD undoes the fit curve operation. The PEDIT prompt returns.

7. Now choose the Spline option by typing S and pressing Enter. AutoCAD spline-fits the polyline. Note that this curve more closely approximates the contour. Exit the PEDIT command by pressing Enter.

8. By turning on the spline frame, you can examine the original data points for this new curve. At the Command: prompt, enter SPLFRAME and press Enter. Respond to the SPLFRAME prompt by typing 1 and pressing Enter.

9. For the spline frame to display, you must regenerate the drawing. At the Command: prompt, type REGEN and press Enter. The spline frame displays. Note that with an open polyline such as this contour line, the spline-fit curve passes through the spline frame at the start and end points.

10. Turn the spline frame off by repeating step 8, but setting the SPLFRAME variable to 0. Then perform another regen to clear the frame.

11. You will use this drawing and view in the next exercise. For now, save the drawing by pressing Ctrl+S.

In the preceding exercise, you saw how the PEDIT command takes data points in the form of polyline vertices and transforms them into a close approximation of a true b-spline curve. In many instances, these polyline spline-fit curves are adequate for representing data such as contour lines. At other times, the smoothing procedure of the fit-curve procedure will suffice to remove the angles present at polyline vertices.


NOTE: Lightweight polylines do not support either the fit-curve or spline-fit options of the PEDIT command. Whenever you choose either of these options, AutoCAD, if necessary, converts lightweight polylines into the old-style 2D polyline, and then carries out the transformation to a curve. If the curve is subsequently changed back to its original shape using the Decurve option of the PEDIT Command, AutoCAD converts the 2D polyline back into a lightweight polyline.

Editing Polyline Vertices with PEDIT

Each polyline segment belongs to and is controlled by the preceding vertex. The Edit vertex option of the primary PEDIT set of options displays another prompt with a separate set of options. When you use these options, AutoCAD marks the current vertex of the polyline with an X to show the vertex you are editing. Move the X (by pressing Enter to accept the <N>, next, prompt) until the X marks the vertex you want to edit.

Options for the Edit vertex option of the PEDIT command are as follows:


TIP: It is usually easier to edit the position of a polyline vertex by using AutoCAD's Grips feature. This is especially true for spline-fit polylines. Chapter 10, "Basic Object Editing," covers grips editing.

In the following exercise, you perform vertex editing on polylines in the current exercise drawing.

EDITING POLYLINE VERTICES WITH PEDIT

1. Continue in the drawing from the previous exercise (see fig. 8.10). You first move the first vertex of the polyline contour at 1. Begin by starting the PEDIT command and pick the contour line at 1.

Figure 8.10 Moving a polyline vertex.

2. At the primary PEDIT prompt, choose the Edit vertex option by typing E and pressing Enter. Note that an X appears at the endpoint and first vertex of the line and the Edit vertex: prompt appears.

3. If the vertex you want to move is already selected (marked with an X), respond to this prompt by typing M and pressing Enter. Respond to the Enter new location: prompt by typing @0,-12 and pressing Enter. (Note: Watch the vertex as you press Enter.)

4. Move the vertex down 12 units in the -Y direction. The Edit vertex prompt returns.


TIP: In the next step, if you go too far, type P and press Enter to return to the previous vertex.

5. For the purposes of this exercise, assume you want to insert a new vertex between the current fourth and fifth vertices, as shown at 2. "Walk" the current vertex down the line by pressing Enter to accept the default Next (vertex) option. You need to press Enter three times. The X is now at vertex 4 at 3 (see fig. 8.11).

Figure 8.11 Inserting a new vertex.

6. Now choose the Insert option by typing I and pressing Enter. Answer the Enter location of new vertex: prompt by picking a point near 4, as shown in figure 8.11. AutoCAD inserts a new vertex and the prompt returns.

7. Select the Edit vertex mode by typing X and pressing Enter. The primary PEDIT prompt returns. Select the Spline option by typing S and pressing Enter. AutoCAD spline-fits the curve.

8. Close the PEDIT command by accepting the default <X> (eXit) option.

9. Re-start the PEDIT command by pressing the spacebar. At the PEDIT prompt, pick the polyline at 5. You will change the width of the vertex at the base of the arrowhead.

10. Choose the Edit vertex option of the primary PEDIT prompt and choose Next until the active vertex is at the base of the arrowhead. This is the third vertex.


NOTE: In the next step, watch the width of the arrowhead as you press Enter.

11. Choose the Width option by typing W and pressing Enter. At the Enter starting width <1'-4">: prompt, enter the new value by typing 20 and pressing Enter. AutoCAD changes the width of the arrowhead base. At the Enter ending width <1'-8">: prompt, type 0 and press Enter.

12. Exit the Edit vertex prompt by typing X and pressing Enter. Then exit the PEDIT command. Your drawing should now resemble figure 8.12.

Figure 8.12 The finished parking lot drawing.

In the preceding exercise, you saw how to make changes to an existing polyline by editing parameters at its vertices. When combined with the primary editing option, the Edit vertex option provides a great degree of editing capability for polylines.

Creating True Splines

To create true spline curves in AutoCAD Release 14, you use the SPLINE command. Splines can be either 2D or 3D objects. You draw splines by specifying a series of fit-data points (vertices) through which the curve passes. The fit-data points determine the location of the spline's control points. Control points contain the curve information for the spline. AutoCAD's spline objects are true splines, unlike the spline approximations formed by spline-fit polylines. AutoCAD's SPLINE command draws non-uniform rational B-splines (NURBS). AutoCAD NURBS are mathematically more accurate than spline-fit polylines. Even though spline objects are more accurate than spline-fit polylines, they actually require less memory for storage and result in smaller drawings, other factors being equal.

You can use the SPLINE command to convert 2D and 3D spline-fit polylines into true splines. Unlike spline-fit polylines, which may be either quadric or cubic spline approximations depending on how the SPLINETYPE system variable is set, the SPLINETYPE system variable does not affect the true spline objects produced by the SPLINE command.

The SPLINE command offers the following options:

In the following exercise, you use the SPLINE command to draw the outline of a mechanical part.

CONSTRUCTING A SPLINE

1. Begin a new drawing called Spline.dwg using the book's IAC803.DWG on the accompanying CD as a template (see fig. 8.13).

Figure 8.13 Fitting a spline to data points.

In the next step, you use the pre-positioned data points shown in the drawing by X points. A node running Osnap has been set so you can easily snap to these data points.

2. Start the SPLINE command by either entering SPL and pressing Enter or by choosing the Spline tool from the Draw toolbar. The Object/<Enter first point>: prompt appears.

3. Use the default option by setting an Endpoint Osnap and snapping to the endpoint at 1. The Enter point: prompt appears.

4. Continue to specify points, snapping to each successive X node at each Enter point: prompt. Finally, invoke another Endpoint Osnap and snap to the point at 2.

5. Press Enter to end the Enter point: prompt. The Enter start tangent: prompt appears.

6. A rubber band line stretches from the first spline point. Invoke the ORTHO mode (press F8) and pick a point near 3. At the Enter end tangent: prompt, pick a point near 4. AutoCAD completes the spline.

7. Turn ORTHO mode off by pressing F8 again. Your drawing should now resemble figure 8.14.

Figure 8.14 The completed spline curve.

8. You will use this drawing in the next exercise, but for now save your work by pressing Ctrl+S.

In the preceding exercise, you used pre-positioned points to help construct the spline. Depending on the type of work you want to do, you usually base splines on some form of preliminary data points rather than just draw the curve in free-form style, although both methods are available with AutoCAD. At best, splines are "tricky" objects to construct, and once drawn, you frequently need to alter or refine them.

Controlling Splines with SPLINEDIT

The SPLINEDIT command enables you to edit a spline's control points and, if present, fit-data points. When you draw a spline, you pick fit-data points. AutoCAD uses these points to calculate the location of the spline's control points. You can add additional control or fit-data points or move points already present. You can change the weight, or influence of control points, as well as the tolerance of the spline. You also can close or open a spline and adjust the tangent information of the start and endpoints.

Control points usually are not located on the spline curve (except at the start and endpoints), but they control the shape of the spline. AutoCAD uses the fit-data points to calculate the position of the control points. After AutoCAD determines the control points, it no longer needs the fit-data points. If you remove the fit-data from a spline, though, you cannot use any of the fit-data editing options of the SPLINEDIT command to further edit the shape of the spline.

When you select a spline for editing, AutoCAD displays its control points just as it does if you use grips editing, although grips editing is not available through the SPLINEDIT command. The SPLINEDIT command works on only one spline object at a time. The Noun/Verb selection method is not available with SPLINEDIT.

The SPLINEDIT command has the following options:

The following are the suboptions of the Fit Data option for editing spline object fit-data. When you choose the Fit Data option, the grips-like boxes change to highlight the fit-data points.

In the following exercise, you edit the spline you drew in the preceding exercise using some of the options of the SPLINEDIT command. First, you reduce the number of fit-data points, and then you add additional control points to the spline by changing its order.

EDITING A SPLINE

1. Continue from the previous exercise. Remove the running node osnap.

2. Start the SPLINEDIT command by either clicking on the Splinedit tool on the Modify II toolbar, or from the Modify menu, choose Object, Spline. Select the spline you drew in the preceding exercise. The control points appear (see fig. 8.15) and the following prompt appears:

Fit Data/Close/Move Vertex/Refine/rEverse/Undo/eXit <X>:

Figure 8.15 The Fit Data option displays a spline's control points.

3. Choose the Fit Data option by typing either F or D and then pressing Enter. AutoCAD changes the control points to show the fit data points. Notice that the fit data points are not the same as the control points. The Fit Data prompt appears.

4. Choose the Delete option and then pick a couple of points. Note that the points disappear as you pick them. Press Enter after you remove the points. The prompt returns. Choose the Tangents option. The System default/<Enter start tangent>: prompt appears.

5. Press Enter to keep the current tangent. Then at the System default/<Enter end tangent>: prompt, pick a point near 1, as shown in figure 8.15.

6. When the prompt returns, press Enter to return to the main control point prompt. The control points are displayed and the control point prompt appears.

7. Choose the Refine option, and then at the new prompt, choose the Elevate option.

8. At the Enter new order <4>: prompt, type 6 and press Enter. This elevates the order of the polynomial and adds control points. The prompt returns. Respond by pressing Enter to exit to the main prompt.

9. Press Enter again to exit the PLINEDIT command.

10. From the layer control box on the Object Properties toolbar, turn off the layer Frame. Your drawing should now resemble figure 8.16. You are finished with this drawing.

Figure 8.16 Completed spline-fit curve.

The options and sub-options of the SPLINEDIT command offer a great deal of control. In this exercise, you had the opportunity to investigate several ways you can modify and "tweak" a spline object. Splines are quite complex, but offer the advantage of also being quite accurate and flexible.


TIP: As with polylines, the most efficient way to edit true splines often is to use AutoCAD's grips editing feature. Chapter 10, "Basic Object Editing," tells more about grips editing.

Summary

In this chapter, you explored the versatility of polylines. You learned about AutoCAD Release 14's new lightweight polyline and saw how you can edit polylines in a variety of ways. You also saw how to convert polylines into two different types of curves. You learned about the versatility and accuracy of true NURB splines and the many ways of editing and shaping them into complex smooth curves. Many of the shapes you may be required to draw in AutoCAD are not composed of straight lines, and being able to fit polylines to complex curves is an important skill to have.


Previous chapterNext chapterContents

© Copyright, Macmillan Computer Publishing. All rights reserved.